// 全局样式文件
// 导入 Element Plus 样式
@import 'element-plus/dist/index.css';

// 导入自定义样式模块
@import './variables.scss';
@import './mixins.scss';
@import './responsive.scss';
@import './components.scss';
@import './animations.scss';

// 全局样式重置
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: $font-family-base;
  font-size: $font-size-base;
  line-height: $line-height-base;
  color: $text-color-primary;
  background-color: $bg-color;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

// 容器样式
.container {
  width: 100%;
  max-width: $container-max-width;
  margin: 0 auto;
  padding: 0 $container-padding;
  
  @include respond-to('tablet') {
    padding: 0 $container-padding-tablet;
  }
  
  @include respond-to('mobile') {
    padding: 0 $container-padding-mobile;
  }
}

// 通用工具类
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.d-flex { display: flex; }
.d-block { display: block; }
.d-inline { display: inline; }
.d-inline-block { display: inline-block; }
.d-none { display: none; }

.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-around { justify-content: space-around; }
.justify-start { justify-content: flex-start; }
.justify-end { justify-content: flex-end; }

.align-center { align-items: center; }
.align-start { align-items: flex-start; }
.align-end { align-items: flex-end; }
.align-stretch { align-items: stretch; }

.flex-column { flex-direction: column; }
.flex-row { flex-direction: row; }
.flex-wrap { flex-wrap: wrap; }
.flex-nowrap { flex-wrap: nowrap; }

.flex-1 { flex: 1; }
.flex-auto { flex: auto; }
.flex-none { flex: none; }

// 间距工具类
@for $i from 0 through 10 {
  .m-#{$i} { margin: #{$i * 4}px; }
  .mt-#{$i} { margin-top: #{$i * 4}px; }
  .mr-#{$i} { margin-right: #{$i * 4}px; }
  .mb-#{$i} { margin-bottom: #{$i * 4}px; }
  .ml-#{$i} { margin-left: #{$i * 4}px; }
  .mx-#{$i} { margin-left: #{$i * 4}px; margin-right: #{$i * 4}px; }
  .my-#{$i} { margin-top: #{$i * 4}px; margin-bottom: #{$i * 4}px; }
  
  .p-#{$i} { padding: #{$i * 4}px; }
  .pt-#{$i} { padding-top: #{$i * 4}px; }
  .pr-#{$i} { padding-right: #{$i * 4}px; }
  .pb-#{$i} { padding-bottom: #{$i * 4}px; }
  .pl-#{$i} { padding-left: #{$i * 4}px; }
  .px-#{$i} { padding-left: #{$i * 4}px; padding-right: #{$i * 4}px; }
  .py-#{$i} { padding-top: #{$i * 4}px; padding-bottom: #{$i * 4}px; }
}

// 文字颜色
.text-primary { color: $color-primary; }
.text-success { color: $color-success; }
.text-warning { color: $color-warning; }
.text-danger { color: $color-danger; }
.text-info { color: $color-info; }
.text-muted { color: $text-color-secondary; }

// 背景颜色
.bg-primary { background-color: $color-primary; }
.bg-success { background-color: $color-success; }
.bg-warning { background-color: $color-warning; }
.bg-danger { background-color: $color-danger; }
.bg-info { background-color: $color-info; }
.bg-light { background-color: $bg-color-light; }
.bg-dark { background-color: $bg-color-dark; }

// 边框
.border { border: 1px solid $border-color; }
.border-top { border-top: 1px solid $border-color; }
.border-right { border-right: 1px solid $border-color; }
.border-bottom { border-bottom: 1px solid $border-color; }
.border-left { border-left: 1px solid $border-color; }
.border-none { border: none; }

// 圆角
.rounded { border-radius: $border-radius; }
.rounded-sm { border-radius: $border-radius-sm; }
.rounded-lg { border-radius: $border-radius-lg; }
.rounded-full { border-radius: 50%; }
.rounded-none { border-radius: 0; }

// 阴影
.shadow { box-shadow: $box-shadow; }
.shadow-sm { box-shadow: $box-shadow-sm; }
.shadow-lg { box-shadow: $box-shadow-lg; }
.shadow-none { box-shadow: none; }

// 位置
.position-relative { position: relative; }
.position-absolute { position: absolute; }
.position-fixed { position: fixed; }
.position-sticky { position: sticky; }
.position-static { position: static; }

// 溢出
.overflow-hidden { overflow: hidden; }
.overflow-auto { overflow: auto; }
.overflow-scroll { overflow: scroll; }
.overflow-visible { overflow: visible; }

// 文字省略
.text-ellipsis {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.text-ellipsis-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

.text-ellipsis-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

// 响应式显示/隐藏
@include respond-to('mobile') {
  .d-mobile-none { display: none !important; }
  .d-mobile-block { display: block !important; }
  .d-mobile-flex { display: flex !important; }
}

@include respond-to('tablet') {
  .d-tablet-none { display: none !important; }
  .d-tablet-block { display: block !important; }
  .d-tablet-flex { display: flex !important; }
}

@include respond-to('desktop') {
  .d-desktop-none { display: none !important; }
  .d-desktop-block { display: block !important; }
  .d-desktop-flex { display: flex !important; }
}

// 滚动条样式
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: $bg-color-light;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
  background: $border-color;
  border-radius: 4px;
  
  &:hover {
    background: $text-color-secondary;
  }
}

// 选择文本样式
::selection {
  background-color: rgba($color-primary, 0.2);
  color: $text-color-primary;
}

::-moz-selection {
  background-color: rgba($color-primary, 0.2);
  color: $text-color-primary;
}

// 焦点样式
:focus {
  outline: 2px solid rgba($color-primary, 0.5);
  outline-offset: 2px;
}

// 禁用状态
.disabled,
[disabled] {
  opacity: 0.6;
  cursor: not-allowed;
  pointer-events: none;
}

// 加载状态
.loading {
  position: relative;
  pointer-events: none;
  
  &::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid transparent;
    border-top: 2px solid $color-primary;
    border-radius: 50%;
    animation: spin 1s linear infinite;
  }
}

// 图片响应式
.img-responsive {
  max-width: 100%;
  height: auto;
  display: block;
}

// 视频响应式
.video-responsive {
  position: relative;
  padding-bottom: 56.25%; // 16:9 比例
  height: 0;
  overflow: hidden;
  
  iframe,
  object,
  embed,
  video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
  }
}